package com.tian.enums;

import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

/**
 * {@code @description:} 有效期类型枚举类
 *
 * @author tianwc 公众号：Java后端技术全栈
 * 在线刷题 1200+java面试题和1000+篇技术文章：<a href="https://woaijava.cc/">博客地址</a>
 * {@code @date:} 2024-11-18 9:14
 * {@code @version:} 1.0
 */
@Getter
public enum CouponValidityTypeEnum {
    /**
     * 固定有效期
     */
    FIXED(0, "固定有效期"),
    /**
     * 动态有效期
     */
    DYNAMIC(1, "动态有效期");

    private final int status;
    private final String desc;

    private static final Map<Integer, CouponValidityTypeEnum> COUPON_STATUS_ENUM_MAP = new HashMap<>();

    CouponValidityTypeEnum(int status, String desc) {
        this.status = status;
        this.desc = desc;
    }

    static {
        for (CouponValidityTypeEnum couponStatusEnum : CouponValidityTypeEnum.values()) {
            COUPON_STATUS_ENUM_MAP.put(couponStatusEnum.getStatus(), couponStatusEnum);
        }
    }
    public static String getDesByStatus(int status) {
        return COUPON_STATUS_ENUM_MAP.get(status).getDesc();
    }
}
